<%--
  Created by IntelliJ IDEA.
  User: tjb
  Date: 2020/8/26
  Time: 11:33
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE HTML>
<html>
<head>
    <title>注册</title>
    <script src="js/jquery-3.5.1.min.js"></script>
    <script>
        function fun(){
            var kk = $("#mydiv").val();
            console.log(kk);
            $.ajax({
                url:"ajaxServlet",
                type:"get",
                data:{"kk":kk},
                dataType:"text",
                success:function(re){
                    $("#namespan").text(re);
                },
                error:function(){
                    $("#namespan").text("不可注册");
                },
                timeout:3000
            })
        }
    </script>
</head>
<style>
    body{

        background-color: peachpuff;
    }
    .div1{
        border-radius:5px;
        border:2px solid;
        width:300px;
        height:250px;
        top: 0px;
        left: 0px;
        right: 0px;
        bottom: 0px;
        margin: auto;
        position: fixed;
        background-color:pink;
    }
</style>
<body>
<div class="div1">
    <div style="padding-left:110px;"><h3>用户注册</h3></div>
    <form method="get" action="loginServlet">
    <div style="padding-left:55px">
    用户名：<div><input id="mydiv" onblur="fun()" type="text" name="username" placeholder="请输入用户名"><span style="color:red" id="namespan"></span></div>
    真实姓名：<div><input type="text" name="name" placeholder="请输入姓名"></div>
    密码：<div><input type="password" name="password" placeholder="请输入密码"></div>
         <input style="margin:20px 0px 0px 60px" type="submit" value="提交">
    </div>
    </form>
</div>
</body>
</html>
